<%@ Page Language="VB" %>

<script runat="server">
  Protected Sub AnalyzeName_Click(ByVal sender As Object, ByVal e As System.EventArgs)

    Dim Name As New NameComponent.NameFunctionsClass()

    If (FirstName.Text.Length > 0) Then
      Name.FirstName = FirstName.Text
    End If

    If (LastName.Text.Length > 0) Then
      Name.LastName = LastName.Text
    End If

    If (FullName.Text.Length > 0) Then
      Name.FullName = FullName.Text
    End If

    FirstName.Text = Name.FirstName
    LastName.Text = Name.LastName
    FullName.Text = Name.FullName
    FullNameLength.Text = Name.FullNameLength.ToString

  End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
     <title>Wykorzystanie komponentw COM</title>
  </head>
  <body>
    <form id="form1" runat="server">
      <P>
        <asp:Label ID="Label1" runat="server">Imi:</asp:Label>
        &nbsp;
        <asp:TextBox ID="FirstName" runat="server"></asp:TextBox>
      </P>
      <P>
        <asp:Label ID="Label2" runat="server">Nazwisko:</asp:Label>
        &nbsp;
        <asp:TextBox ID="LastName" runat="server"></asp:TextBox>
      </P>
      <P>
        <asp:Label ID="Label3" runat="server">Imi i nazwisko:</asp:Label>
        &nbsp;
        <asp:TextBox ID="FullName" runat="server"></asp:TextBox>
      </P>
      <P>
        <asp:Label ID="Label4" runat="server">Dugo imienia i nazwiska:</asp:Label>
        &nbsp;
        <asp:Label ID="FullNameLength" runat="server" 
         Font-Bold="True">0</asp:Label>
      </P>
      <P>
        <asp:Button ID="AnalyzeName" runat="server" 
         OnClick="AnalyzeName_Click" Text="Analizuj"></asp:Button>
      </P>
    </form>
  </body>
</html>
